﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Castle.DynamicProxy;
using Autofac.Integration.Mvc;
using System.Web.Mvc;

namespace CNKI.TPI.Web.Base
{
    public class BaseDAO
    {
        protected IDataContext context;

        public IDataContext Context
        {
            get { return context; }
            set { context = generator.CreateInterfaceProxyWithTarget<IDataContext>(value); }
        }

        private ProxyGenerator generator;
        public BaseDAO()
        {
            this.generator = new ProxyGenerator();
        }
    }
}
